package leetcode.editor.cn1;

import com.leetcode.entity.TreeNode;

public class MaxDepthLcof {
    public static void main(String[] args) {
        Solution solution = new MaxDepthLcof().new Solution();

        TreeNode root = new TreeNode(3);
        root.left = new TreeNode(9);
        root.right = new TreeNode(20);
        root.right.left = new TreeNode(15);
        root.right.right = new TreeNode(7);
//        root.right.left.left = new TreeNode(7);
//        root.right.left.left.left = new TreeNode(7);
        System.out.println(solution.maxDepth(root));


    }
    class Solution {
        public int maxDepth(TreeNode root) {
            if (root == null)
                return 0;
            return 1 + Math.max(maxDepth(root.left), maxDepth(root.right));
        }
    }
}
